\(\int \cos ^2(c+d x) \cot ^2(c+d x) (a+b \sin (c+d x)) \, dx\) [1097]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 27, antiderivative size = 83 \[ \int \cos ^2(c+d x) \cot ^2(c+d x) (a+b \sin (c+d x)) \, dx=-\frac {3 a x}{2}-\frac {b \text {arctanh}(\cos (c+d x))}{d}+\frac {b \cos (c+d x)}{d}+\frac {b \cos ^3(c+d x)}{3 d}-\frac {3 a \cot (c+d x)}{2 d}+\frac {a \cos ^2(c+d x) \cot (c+d x)}{2 d} \]

[Out]

-3/2*a*x-b*arctanh(cos(d*x+c))/d+b*cos(d*x+c)/d+1/3*b*cos(d*x+c)^3/d-3/2*a*cot(d*x+c)/d+1/2*a*cos(d*x+c)^2*cot
(d*x+c)/d

Rubi [A] (verified)

Time = 0.10 (sec) , antiderivative size = 83, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.296, Rules used = {2917, 2671, 294, 327, 209, 2672, 308, 212} \[ \int \cos ^2(c+d x) \cot ^2(c+d x) (a+b \sin (c+d x)) \, dx=-\frac {3 a \cot (c+d x)}{2 d}+\frac {a \cos ^2(c+d x) \cot (c+d x)}{2 d}-\frac {3 a x}{2}-\frac {b \text {arctanh}(\cos (c+d x))}{d}+\frac {b \cos ^3(c+d x)}{3 d}+\frac {b \cos (c+d x)}{d} \]

[In]

Int[Cos[c + d*x]^2*Cot[c + d*x]^2*(a + b*Sin[c + d*x]),x]

[Out]

(-3*a*x)/2 - (b*ArcTanh[Cos[c + d*x]])/d + (b*Cos[c + d*x])/d + (b*Cos[c + d*x]^3)/(3*d) - (3*a*Cot[c + d*x])/
(2*d) + (a*Cos[c + d*x]^2*Cot[c + d*x])/(2*d)

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 294

Int[((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^
n)^(p + 1)/(b*n*(p + 1))), x] - Dist[c^n*((m - n + 1)/(b*n*(p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^(p + 1), x
], x] /; FreeQ[{a, b, c}, x] && IGtQ[n, 0] && LtQ[p, -1] && GtQ[m + 1, n] &&  !ILtQ[(m + n*(p + 1) + 1)/n, 0]
&& IntBinomialQ[a, b, c, n, m, p, x]

Rule 308

Int[(x_)^(m_)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Int[PolynomialDivide[x^m, a + b*x^n, x], x] /; FreeQ[{a,
b}, x] && IGtQ[m, 0] && IGtQ[n, 0] && GtQ[m, 2*n - 1]

Rule 327

Int[((c_.)*(x_))^(m_)*((a_) + (b_.)*(x_)^(n_))^(p_), x_Symbol] :> Simp[c^(n - 1)*(c*x)^(m - n + 1)*((a + b*x^n
)^(p + 1)/(b*(m + n*p + 1))), x] - Dist[a*c^n*((m - n + 1)/(b*(m + n*p + 1))), Int[(c*x)^(m - n)*(a + b*x^n)^p
, x], x] /; FreeQ[{a, b, c, p}, x] && IGtQ[n, 0] && GtQ[m, n - 1] && NeQ[m + n*p + 1, 0] && IntBinomialQ[a, b,
 c, n, m, p, x]

Rule 2671

Int[sin[(e_.) + (f_.)*(x_)]^(m_)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> With[{ff = FreeFactors[Ta
n[e + f*x], x]}, Dist[b*(ff/f), Subst[Int[(ff*x)^(m + n)/(b^2 + ff^2*x^2)^(m/2 + 1), x], x, b*(Tan[e + f*x]/ff
)], x]] /; FreeQ[{b, e, f, n}, x] && IntegerQ[m/2]

Rule 2672

Int[((a_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*tan[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> With[{ff = FreeFactors[S
in[e + f*x], x]}, Dist[ff/f, Subst[Int[(ff*x)^(m + n)/(a^2 - ff^2*x^2)^((n + 1)/2), x], x, a*(Sin[e + f*x]/ff)
], x]] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n + 1)/2]

Rule 2917

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((a_) + (b_.)*sin[(e_.) + (f_.)
*(x_)]), x_Symbol] :> Dist[a, Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^n, x], x] + Dist[b/d, Int[(g*Cos[e + f*x
])^p*(d*Sin[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, g, n, p}, x]

Rubi steps \begin{align*} \text {integral}& = a \int \cos ^2(c+d x) \cot ^2(c+d x) \, dx+b \int \cos ^3(c+d x) \cot (c+d x) \, dx \\ & = -\frac {a \text {Subst}\left (\int \frac {x^4}{\left (1+x^2\right )^2} \, dx,x,\cot (c+d x)\right )}{d}-\frac {b \text {Subst}\left (\int \frac {x^4}{1-x^2} \, dx,x,\cos (c+d x)\right )}{d} \\ & = \frac {a \cos ^2(c+d x) \cot (c+d x)}{2 d}-\frac {(3 a) \text {Subst}\left (\int \frac {x^2}{1+x^2} \, dx,x,\cot (c+d x)\right )}{2 d}-\frac {b \text {Subst}\left (\int \left (-1-x^2+\frac {1}{1-x^2}\right ) \, dx,x,\cos (c+d x)\right )}{d} \\ & = \frac {b \cos (c+d x)}{d}+\frac {b \cos ^3(c+d x)}{3 d}-\frac {3 a \cot (c+d x)}{2 d}+\frac {a \cos ^2(c+d x) \cot (c+d x)}{2 d}+\frac {(3 a) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\cot (c+d x)\right )}{2 d}-\frac {b \text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\cos (c+d x)\right )}{d} \\ & = -\frac {3 a x}{2}-\frac {b \text {arctanh}(\cos (c+d x))}{d}+\frac {b \cos (c+d x)}{d}+\frac {b \cos ^3(c+d x)}{3 d}-\frac {3 a \cot (c+d x)}{2 d}+\frac {a \cos ^2(c+d x) \cot (c+d x)}{2 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.34 (sec) , antiderivative size = 105, normalized size of antiderivative = 1.27 \[ \int \cos ^2(c+d x) \cot ^2(c+d x) (a+b \sin (c+d x)) \, dx=-\frac {3 a (c+d x)}{2 d}+\frac {5 b \cos (c+d x)}{4 d}+\frac {b \cos (3 (c+d x))}{12 d}-\frac {a \cot (c+d x)}{d}-\frac {b \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )}{d}+\frac {b \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{d}-\frac {a \sin (2 (c+d x))}{4 d} \]

[In]

Integrate[Cos[c + d*x]^2*Cot[c + d*x]^2*(a + b*Sin[c + d*x]),x]

[Out]

(-3*a*(c + d*x))/(2*d) + (5*b*Cos[c + d*x])/(4*d) + (b*Cos[3*(c + d*x)])/(12*d) - (a*Cot[c + d*x])/d - (b*Log[
Cos[(c + d*x)/2]])/d + (b*Log[Sin[(c + d*x)/2]])/d - (a*Sin[2*(c + d*x)])/(4*d)

Maple [A] (verified)

Time = 0.39 (sec) , antiderivative size = 88, normalized size of antiderivative = 1.06

method result size
parallelrisch \(\frac {48 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b -27 \left (\cos \left (d x +c \right )-\frac {\cos \left (3 d x +3 c \right )}{9}\right ) \sec \left (\frac {d x}{2}+\frac {c}{2}\right ) a \csc \left (\frac {d x}{2}+\frac {c}{2}\right )-72 a x d +60 b \cos \left (d x +c \right )+4 b \cos \left (3 d x +3 c \right )+64 b}{48 d}\) \(88\)
derivativedivides \(\frac {a \left (-\frac {\cos ^{5}\left (d x +c \right )}{\sin \left (d x +c \right )}-\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )+b \left (\frac {\left (\cos ^{3}\left (d x +c \right )\right )}{3}+\cos \left (d x +c \right )+\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )\right )}{d}\) \(94\)
default \(\frac {a \left (-\frac {\cos ^{5}\left (d x +c \right )}{\sin \left (d x +c \right )}-\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )-\frac {3 d x}{2}-\frac {3 c}{2}\right )+b \left (\frac {\left (\cos ^{3}\left (d x +c \right )\right )}{3}+\cos \left (d x +c \right )+\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )\right )}{d}\) \(94\)
risch \(-\frac {3 a x}{2}+\frac {i a \,{\mathrm e}^{2 i \left (d x +c \right )}}{8 d}+\frac {5 b \,{\mathrm e}^{i \left (d x +c \right )}}{8 d}+\frac {5 b \,{\mathrm e}^{-i \left (d x +c \right )}}{8 d}-\frac {i a \,{\mathrm e}^{-2 i \left (d x +c \right )}}{8 d}-\frac {2 i a}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}-\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{d}+\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{d}+\frac {b \cos \left (3 d x +3 c \right )}{12 d}\) \(138\)
norman \(\frac {\frac {4 b \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {4 b \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}-\frac {a}{2 d}-\frac {2 a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {2 a \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {a \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d}-\frac {3 a x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2}-\frac {9 a x \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}-\frac {9 a x \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}-\frac {3 a x \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}+\frac {8 b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{3 d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}+\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}\) \(209\)

[In]

int(cos(d*x+c)^4*csc(d*x+c)^2*(a+b*sin(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/48*(48*ln(tan(1/2*d*x+1/2*c))*b-27*(cos(d*x+c)-1/9*cos(3*d*x+3*c))*sec(1/2*d*x+1/2*c)*a*csc(1/2*d*x+1/2*c)-7
2*a*x*d+60*b*cos(d*x+c)+4*b*cos(3*d*x+3*c)+64*b)/d

Fricas [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 107, normalized size of antiderivative = 1.29 \[ \int \cos ^2(c+d x) \cot ^2(c+d x) (a+b \sin (c+d x)) \, dx=\frac {3 \, a \cos \left (d x + c\right )^{3} - 3 \, b \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) + 3 \, b \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) \sin \left (d x + c\right ) - 9 \, a \cos \left (d x + c\right ) + {\left (2 \, b \cos \left (d x + c\right )^{3} - 9 \, a d x + 6 \, b \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{6 \, d \sin \left (d x + c\right )} \]

[In]

integrate(cos(d*x+c)^4*csc(d*x+c)^2*(a+b*sin(d*x+c)),x, algorithm="fricas")

[Out]

1/6*(3*a*cos(d*x + c)^3 - 3*b*log(1/2*cos(d*x + c) + 1/2)*sin(d*x + c) + 3*b*log(-1/2*cos(d*x + c) + 1/2)*sin(
d*x + c) - 9*a*cos(d*x + c) + (2*b*cos(d*x + c)^3 - 9*a*d*x + 6*b*cos(d*x + c))*sin(d*x + c))/(d*sin(d*x + c))

Sympy [F]

\[ \int \cos ^2(c+d x) \cot ^2(c+d x) (a+b \sin (c+d x)) \, dx=\int \left (a + b \sin {\left (c + d x \right )}\right ) \cos ^{4}{\left (c + d x \right )} \csc ^{2}{\left (c + d x \right )}\, dx \]

[In]

integrate(cos(d*x+c)**4*csc(d*x+c)**2*(a+b*sin(d*x+c)),x)

[Out]

Integral((a + b*sin(c + d*x))*cos(c + d*x)**4*csc(c + d*x)**2, x)

Maxima [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 91, normalized size of antiderivative = 1.10 \[ \int \cos ^2(c+d x) \cot ^2(c+d x) (a+b \sin (c+d x)) \, dx=-\frac {3 \, {\left (3 \, d x + 3 \, c + \frac {3 \, \tan \left (d x + c\right )^{2} + 2}{\tan \left (d x + c\right )^{3} + \tan \left (d x + c\right )}\right )} a - {\left (2 \, \cos \left (d x + c\right )^{3} + 6 \, \cos \left (d x + c\right ) - 3 \, \log \left (\cos \left (d x + c\right ) + 1\right ) + 3 \, \log \left (\cos \left (d x + c\right ) - 1\right )\right )} b}{6 \, d} \]

[In]

integrate(cos(d*x+c)^4*csc(d*x+c)^2*(a+b*sin(d*x+c)),x, algorithm="maxima")

[Out]

-1/6*(3*(3*d*x + 3*c + (3*tan(d*x + c)^2 + 2)/(tan(d*x + c)^3 + tan(d*x + c)))*a - (2*cos(d*x + c)^3 + 6*cos(d
*x + c) - 3*log(cos(d*x + c) + 1) + 3*log(cos(d*x + c) - 1))*b)/d

Giac [A] (verification not implemented)

none

Time = 0.33 (sec) , antiderivative size = 142, normalized size of antiderivative = 1.71 \[ \int \cos ^2(c+d x) \cot ^2(c+d x) (a+b \sin (c+d x)) \, dx=-\frac {9 \, {\left (d x + c\right )} a - 6 \, b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) - 3 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + \frac {3 \, {\left (2 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + a\right )}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )} - \frac {2 \, {\left (3 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 12 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 12 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 3 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 8 \, b\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{3}}}{6 \, d} \]

[In]

integrate(cos(d*x+c)^4*csc(d*x+c)^2*(a+b*sin(d*x+c)),x, algorithm="giac")

[Out]

-1/6*(9*(d*x + c)*a - 6*b*log(abs(tan(1/2*d*x + 1/2*c))) - 3*a*tan(1/2*d*x + 1/2*c) + 3*(2*b*tan(1/2*d*x + 1/2
*c) + a)/tan(1/2*d*x + 1/2*c) - 2*(3*a*tan(1/2*d*x + 1/2*c)^5 + 12*b*tan(1/2*d*x + 1/2*c)^4 + 12*b*tan(1/2*d*x
 + 1/2*c)^2 - 3*a*tan(1/2*d*x + 1/2*c) + 8*b)/(tan(1/2*d*x + 1/2*c)^2 + 1)^3)/d

Mupad [B] (verification not implemented)

Time = 11.01 (sec) , antiderivative size = 241, normalized size of antiderivative = 2.90 \[ \int \cos ^2(c+d x) \cot ^2(c+d x) (a+b \sin (c+d x)) \, dx=\frac {a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+8\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5-3\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+8\,b\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3-5\,a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+\frac {16\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{3}-a}{d\,\left (2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+6\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+6\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}+\frac {a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2\,d}+\frac {b\,\ln \left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}+\frac {3\,a\,\mathrm {atan}\left (\frac {9\,a^2}{9\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+6\,b\,a}-\frac {6\,a\,b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{9\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2+6\,b\,a}\right )}{d} \]

[In]

int((cos(c + d*x)^4*(a + b*sin(c + d*x)))/sin(c + d*x)^2,x)

[Out]

((16*b*tan(c/2 + (d*x)/2))/3 - a - 5*a*tan(c/2 + (d*x)/2)^2 - 3*a*tan(c/2 + (d*x)/2)^4 + a*tan(c/2 + (d*x)/2)^
6 + 8*b*tan(c/2 + (d*x)/2)^3 + 8*b*tan(c/2 + (d*x)/2)^5)/(d*(2*tan(c/2 + (d*x)/2) + 6*tan(c/2 + (d*x)/2)^3 + 6
*tan(c/2 + (d*x)/2)^5 + 2*tan(c/2 + (d*x)/2)^7)) + (a*tan(c/2 + (d*x)/2))/(2*d) + (b*log(tan(c/2 + (d*x)/2)))/
d + (3*a*atan((9*a^2)/(6*a*b + 9*a^2*tan(c/2 + (d*x)/2)) - (6*a*b*tan(c/2 + (d*x)/2))/(6*a*b + 9*a^2*tan(c/2 +
 (d*x)/2))))/d